
#pragma once

#include <gl\glaux.h>

#include <memory>

int generateUniqueNumber();

class TextureImage
{
public:
    TextureImage();
    TextureImage(const char* filename);
    ~TextureImage();
    bool load(const char* filename);
    bool isValid() const;
    int width() const;
    int height() const;
    const void* data() const;
    operator bool() const;
private:
    std::auto_ptr<AUX_RGBImageRec> pRec;
};

class Texture
{
public:
    Texture(GLenum target = GL_TEXTURE_2D);
    void init(const TextureImage& image, GLint min, GLint mag, GLint level, GLint internalFormat, GLenum  format);
    void initMipmap(const TextureImage& image, GLint min, GLint mag, GLint internalFormat, GLenum  format);
    GLuint id() const;
    GLenum target() const;
private:
    GLenum nTarget;
    GLuint nId;
};






